{% extends 'layout/base.html'%}

{% load static %}

<!-- 右边内容 -->
{% block right_content%}

<div class="layui-container" style="margin-top: 20px;">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8">

      {% if  category_info %}
      <div class="fly-panel">
        <div class="creater_info" style="padding: 20px;display: flex;">
          <a href="/account/u/{{category_info.create_user.id}}" class="avatar">
            <img width="100px" height="100px" src="{{category_info.create_user.avatar}}"
              alt="{{category_info.create_user.username}}">
          </a>
          <div class="info" style="padding-left: 20px;">
            <div class="title">
              <h2>{{category_info.create_user.username}}的笔记</h2>
            </div>
            <div class="rewards" style="margin-top: 5px;">
              <span style="margin-top: 10px;color: grey;">{{category_info.createTime}} 创建</span>
              <span style="color: grey;">《{{category_info.name}}》</span>
            </div>
            <div class="title" style="margin-top: 10px;">
              <p><b>描述：</b>{{category_info.desc}}</p>
            </div>
          </div>
        </div>
      </div>
      {% endif %}

      <div class="fly-panel" style="margin-bottom: 0;">

        <div class="fly-panel-title fly-filter">
          <text class='layui-this'>:) 一朵带杆莲花（打一成语）</text>
        </div>

        <ul class="fly-list">
          {% for a in admin_article %}
          <li>
            <a href="/account/u/{{a.user.id}}" class="fly-avatar">
              <img src="{{a.user.avatar}}" alt="贤心">
            </a>
            <h2>
              <a class="layui-badge">{{a.article_type}}</a>
              <a href="/detail/{{a.id}}">
                {{a.title}}
              </a>
            </h2>
            <div class="fly-list-info">
              <a href="/account/u/{{a.user.id}}" link>
                <cite>{{a.user.username}}</cite>
                <!-- <i class="layui-badge fly-badge-vip">{{i.user.jifen}}</i> -->
              </a>
              <span>{{a.createTime}}</span>
              <span class="fly-list-nums">
                <i class="iconfont icon-pinglun1" title="回答"></i> {{a.comm_num}}
              </span>
            </div>
            <!-- <div class="fly-list-badge">
              <span class="layui-badge-rim">
                <a href="?category={{a.category_id}}" class='layui-this'>{{a.category}}</a>
              </span>
             </div> -->
          </li>
          {% endfor %}
          {% for i in article %}
          <li>
            <a href="/account/u/{{i.user.id}}" class="fly-avatar">
              <img src="{{i.user.avatar}}" alt="贤心">
            </a>
            <h2>
              {% if i.is_top > 0 %}
              <a class="layui-badge">置顶</a>
              {% endif %}

              <a href="/detail/{{i.id}}">
                {{i.title}}
              </a>
            </h2>
            <div class="fly-list-info">
              <a href="/account/u/{{i.user.id}}" link>
                <cite>{{i.user.username}}</cite>
                <!-- <i class="layui-badge fly-badge-vip">{{i.user.jifen}}</i> -->
              </a>
              <span>{{i.createTime}}</span>
              <span class="fly-list-nums">
                <i class="iconfont icon-pinglun1" title="回答"></i> {{i.comm_num}}
              </span>
            </div>
            {% if i.category %}
            <div class="fly-list-badge">
              <span class="layui-badge-rim"><a href="?note={{i.category_id}}"
                  class='layui-this'>{{i.category}}</a></span>
            </div>
            {% endif %}
          </li>
          {% endfor %}

          {% if not article %}
          <div style="text-align: center;color:grey;padding-top: 20px;">暂无内容~</div>
          {% endif %}
        </ul>
        <div style="text-align: center">
          <div style="padding: 20px 0; font-size: 17px;">
            {% if page.has_previous %}
            <a href="/?page={{ page.previous_page_number }}">上一页</a>
            {% endif %}

            {% if page.has_next %}
            <a class="laypage-next" href="/?page={{ page.next_page_number }}">下一页</a>
            {% endif %}
          </div>
        </div>

      </div>
    </div>
    {% endblock %}

    <!-- 左边内容 -->
    {% block left_content %}
    <div class="layui-col-md4">
      <div class="fly-panel">
        <div class="fly-panel-main">
          <p>{{request.web.welcome}}</p>
        </div>
      </div>

      {% if request.user.is_authenticated %}
      <div class="fly-panel">
        <div class="fly-panel-title">
          创建笔记本（不可删除）
        </div>
        <div class="fly-panel-main">
          <form class="layui-form">
            <div>
              <input id="input_val" type="text" maxlength="15" value='' autocomplete="off" name="note_name"
                lay-verify="required" placeholder="输入名称" class="layui-input">
              <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}" />
              <div style="height: 10px;"></div>
              <textarea id='text_val' name="desc" maxlength="255" placeholder="简单表述一下这个笔记本" class="layui-textarea"></textarea>
              <div style="height: 10px;"></div>
              <button class="layui-btn layui-btn-green" lay-submit lay-filter="create">创建</button>
            </div>
          </form>
        </div>
      </div>
      {% endif %}

      <!-- <div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
        <h3 class="fly-panel-title">最近登陆</h3>
        <dl>
          {% for value in user_login %}
          <dd><a href='account/u/{{value.id}}'><img src='{{value.avatar}}'><i>{{value.username}}</i></a></dd>
          {% endfor %}
        </dl>
      </div> -->

      <div class="fly-panel fly-link">
        <h3 class="fly-panel-title">笔记列表</h3>
        <dl id="book_list" class="fly-panel-main">
          <dd><a href="/">所有笔记</a></dd>
          {% for i in cate %}
          <dd><a href="?note={{i.id}}">{{i.name}}</a>
          <dd>
            {% endfor %}
        </dl>
      </div>



      <div class="fly-panel fly-link">
        <h3 class="fly-panel-title">友情链接</h3>
        <dl class="fly-panel-main">
          {% for i in fineurl %}
          <dd><a href="{{i.linkurl}}" target="_blank">{{i.linkname}}</a>
          <dd>
            {% endfor %}

            {% if not fineurl %}
            <text style="color: grey;">暂无~</text>
            {% endif %}
        </dl>
      </div>
    </div>
  </div>
</div>
{% endblock %}

{% block script %}
<script src="{% static 'index/js/index.js' %}"></script>
{% endblock %}